package com.fumihiko.modules.jxxm.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.fumihiko.modules.jxxm.entity.AdjustmentBasisEntity;
import com.fumihiko.modules.jxxm.service.AdjustmentBasisService;
import com.fumihiko.common.utils.PageUtils;
import com.fumihiko.common.utils.R;



/**
 *
 *
 * @author hanwenpeng
 * @email devilzwy@gmail.com
 * @date 2022-09-23 10:52:37
 */
@RestController
@RequestMapping("jxxm/adjustmentbasis")
public class AdjustmentBasisController {
    @Autowired
    private AdjustmentBasisService adjustmentBasisService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("jxxm:adjustmentbasis:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = adjustmentBasisService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("jxxm:adjustmentbasis:info")
    public R info(@PathVariable("id") Long id){
        AdjustmentBasisEntity adjustmentBasis = adjustmentBasisService.getById(id);

        return R.ok().put("adjustmentBasis", adjustmentBasis);
    }

    /**
     * 信息
     */
    @RequestMapping("/infoList")
    @RequiresPermissions("jxxm:adjustmentbasis:infoList")
    public R infoList(){
        AdjustmentBasisEntity adjustmentBasis = adjustmentBasisService.getInfoList();

        return R.ok().put("adjustmentBasis", adjustmentBasis);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("jxxm:adjustmentbasis:save")
    public R save(@RequestBody AdjustmentBasisEntity adjustmentBasis){
		adjustmentBasisService.save(adjustmentBasis);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("jxxm:adjustmentbasis:update")
    public R update(@RequestBody AdjustmentBasisEntity adjustmentBasis){
		adjustmentBasisService.updateById(adjustmentBasis);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("jxxm:adjustmentbasis:delete")
    public R delete(@RequestBody Long[] ids){
		adjustmentBasisService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
